package com.financing.controller.agent;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;

import com.financing.model.user.User;
import com.financing.util.Json;
import com.jfinal.core.Controller;

/**
 *  拜访记录控制器
 * @since 2017-06-06
 * @author 无处不在的二叔
 */
public class AgentController extends Controller {

	
	/** 
	 * 修改用户客服
	 */
	@RequiresRoles(logical=Logical.OR,value={"admin","agent_manager"})  
	public void modify() {
    	User u = User.me.findById(getParaToInt("userId",0));
    	User agent = User.me.findById(getParaToInt("agentId",0));
    	if(u!=null && agent!=null) {
    		u.setAgentId(agent.getId()).update();
			renderJson(Json.ok("修改经纪人成功！"));
    	} else {
			renderJson(Json.error("用户不存在！"));
    	}
	}	
}
 